<template>
  <el-input-number :controls="false" v-bind="defaultAttr" v-model.number="modelValue" style="width: 100%">
  </el-input-number>
</template>

<script setup>
// v-model值
const modelValue = defineModel()

// 输入框配置项
const props = defineProps({
  config: {
    type: Object,
    default: () => {},
  },
})

const defaultAttr = computed(() => {
  // 设置默认绑定值
  let { attrs = {} } = props.config
  // 获取默认项
  attrs['placeholder'] = attrs?.placeholder || `请输入${props.config.label}`
  return { ...attrs }
})
</script>

<style lang="scss" scoped></style>
